<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>班级成绩统计</title>
<script src="../static/echarts/echarts.min.js"></script>
<link rel="stylesheet" href="../static/layui/css/layui.css">
</head>
<body>
<h1>成绩统计</h1>
<br>
<!-- 按钮区 -->
	<div class="site-demo-button" id="layerDemo" style="margin-bottom: 0;">
	  <button class="layui-btn">创建考试</button>
	  <button class="layui-btn">考试管理</button>
	  <button class="layui-btn">学生排名</button>
	</div></br>

<div id="main" style="width: 600px;height:400px;"></div>

<script type="text/javascript" src="../static/js/jquery.min.js"></script>
<script type="text/javascript" src="../static/layui/layui.js"></script>
<script type="text/javascript">
$.post("/OnlineExam1/admin/exam_record?m=classRecord",{"classid":"${param.classid}","recordid":"${param.recordid}"},function(data,status){
	//json数据解析
	var obj=JSON.parse(data);
	// 基于准备好的dom，初始化echarts实例
    var myChart = echarts.init(document.getElementById('main'));

    // 指定图表的配置项和数据
    var option = {
            title: {
                text: '班级成绩统计'
            },
            tooltip: {},
            legend: {
                data:['人数']
            },
            xAxis: {
                data: ["0-60","60-70","70-80","80-90","90-100"]
            },
            yAxis: {},
            series: [{
                name: '销量',
                type: 'bar',
                data: [obj.e, obj.d, obj.c, obj.b, obj.a]
            }]
        };


    // 使用刚指定的配置项和数据显示图表。
    myChart.setOption(option);

//按钮切换
$(function(){
    $("button:eq(0)").click(function(){
    	window.location.href='http://localhost:8080/OnlineExam1/admin/exam_record?m=addExam'
    });

    $("button:eq(1)").click(function(){
    	window.location.href='http://localhost:8080/OnlineExam1/admin/exam_record?m=page'
    }); 

    $("button:eq(2)").click(function(){
    	window.location.href='http://localhost:8080/OnlineExam1/admin/exam_record?m=ranking&classid='+${param.classid}+'&recordid='+${param.recordid}
    });
}); 
});
</script>
</body>
</html>